package demo3;

public class Computer {

    public void openComputer(){
        System.out.println("打开电脑...");
    }

    public void closeComputer(){
        System.out.println("关闭电脑...");
    }

    public void USB(IUSB iusb){
        iusb.openDevice();
        iusb.test();

        if(iusb instanceof Mouse){
            Mouse mouse = (Mouse) iusb;
            mouse.click();
        }

        if(iusb instanceof Keyboard){
            Keyboard keyboard = new Keyboard();
            keyboard.input();
        }

        iusb.closeDevice();
    }
}
